home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
ccdl150l.zip
/
IO
/
FREAD.C
< prev
next >
Wrap
C/C++ Source or Header
|
1997-02-27
|
493b
|
25 lines
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <libp.h>
size_t fread(void *buf, size_t size, size_t count, FILE *stream)
{
int rv;
int len = count * size,i;
char *lbuf = buf;
if (stream->token != FILTOK)
return 0;
if (!(stream->flags & _F_READ)) {
stream->flags |= _F_ERR;
return 0;
}
for (i=0; i < len; i++) {
rv = _basegetc(stream);
if (rv == EOF)
return i / size;
*lbuf++ = (char) rv;
}
return count;
}